﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using x.Domain.User;

namespace x.EntityFrameworkCore
{
    public class UserConfiger : IEntityTypeConfiguration<Users>
    {
        public void Configure(EntityTypeBuilder<Users> builder)
        {
            //配置表
            builder.ToTable(nameof(Users));
            //配置列
            builder.Property(e => e.UserName).HasMaxLength(20);

            //配置种子数据
            builder.HasData(new Users() {
                 Id=1,
                  UserName="张三"
            });
        }
    }
}